<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="common/include :: header('结算单')"></th:block>
</head>
<body>

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form1">
                <div class="col-sm-12">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">客户姓名：</label>
                            <label class="col-sm-6 control-label">[[${statement.customerName}]]</label>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">联系方式：</label>
                            <label class="col-sm-6 control-label">[[${statement.customerPhone}]]</label>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">车牌号码：</label>
                            <label class="col-sm-6 control-label">[[${statement.licensePlate}]]</label>
                        </div>
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">汽车类型：</label>
                            <label class="col-sm-6 control-label">[[${statement.carSeries}]]</label>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">服务类型：</label>
                            <label class="col-sm-6 control-label">[[${statement.serviceType}]]</label>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">到店时间：</label>
                            <label class="col-sm-6 control-label" th:text="${#dates.format(statement.actualArrivalTime, 'yyyy-MM-dd HH:mm')}"></label>
                        </div>
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">总消费金额：</label>
                            <label class="col-sm-6 control-label" id="totalAmount">[[${statement.totalAmount}]]</label>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">服务项数量：</label>
                            <label class="col-sm-6 control-label" id="totalQuantity">[[${statement.totalQuantity}]]</label>
                        </div>
                    </div>

                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">优惠金额：</label>
                            <label class="col-sm-6 control-label" id="discountAmount">[[${statement.discountAmount}]]</label>
                        </div>
                    </div>

                </div>
                <div class="col-sm-12">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">实付价格：</label>
                            <label class="col-sm-6 control-label" id="actrallPaid">[[${statement.totalAmount-statement.discountAmount}]]</label>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">收款人：</label>
                            <label class="col-sm-6 control-label">管理员</label>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">收款时间：</label>
                            <label class="col-sm-6 control-label" th:text="${#dates.format(statement.payTime, 'yyyy-MM-dd HH:mm')}"></label>
                        </div>
                    </div>
                </div>
                <div class="col-sm-12" >
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-6 control-label">备注信息：</label>
                            <label class="col-sm-6 control-label">[[${statement.info}]]</label>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <!--按钮-->
        <div class="btn-group-sm" role="group" id="MyTool" >
            <a class="btn btn-success" >
                <i class="fa fa-print"></i> 打印
            </a>
            <a  class="btn btn-warning" onclick="exportTab()">
                <i class="fa fa-folder-open"></i> 导出
            </a>
        </div>
        <div class="col-sm-8 select-table table-striped">
            <table id="statementItemTable"></table>
        </div>
    </div>
</div>
<th:block th:include="common/include :: footer"></th:block>
<th:block th:include="common/include :: layout-latest" />
    <script th:inline="javascript">
        $(function() {
            var statementId = [[${statement.id}]];
            var options = {
                id:"statementItemTable",
                toolbar:"MyTool",
                uniqueId: "itemId",//服务项的id
                url:"/business/statementItem/query?statementId="+statementId,  			 	//查询的url
                columns: [
                    {
                        field: 'id',
                        title: '服务id',
                        visible: false//是否隐藏id
                    },
                    {
                        field: 'itemName',
                        title: '服务项名称',
                        sortable: true
                    },
                    {
                        field: 'itemPrice',
                        title: '服务项价格',
                        sortable: true
                    },
                    {
                        field: 'itemQuantity',
                        title: '购买数量',
                        sortable: true
                    }]
            };
            $.table.init(options);
        });
        function exportTab() {
            var statementId = [[${statement.id}]];
            window.open("/business/statementItem/exportTab?statementId="+statementId);
        }
    </script>
</body>
</html>